-
Notifications
You must be signed in to change notification settings - Fork 290
Add config setting to avoid adding trailing slash to URLs #1719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #1719 will not alter performanceComparing Summary
|
Bound(Bound<'py, PyUrl>), | ||
Owned(PyUrl), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidhewitt is there a better way of doing this, or a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of this is to avoid allocating the Python object until it's absolutely needed. Maybe call it LazyUrlObject
and have the variants be
Bound(Bound<'py, PyUrl>), | |
Owned(PyUrl), | |
Object(Bound<'py, PyUrl>), | |
Struct(PyUrl), |
impl From<PyUrl> for Url { | ||
fn from(value: PyUrl) -> Url { | ||
value.lib_url | ||
} | ||
} | ||
|
||
#[pymethods] | ||
impl PyUrl { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly query
#[getter]
also needs this treatment?
Bound(Bound<'py, PyUrl>), | ||
Owned(PyUrl), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of this is to avoid allocating the Python object until it's absolutely needed. Maybe call it LazyUrlObject
and have the variants be
Bound(Bound<'py, PyUrl>), | |
Owned(PyUrl), | |
Object(Bound<'py, PyUrl>), | |
Struct(PyUrl), |
EitherUrl::Py(py_url) => Ok(py_url), | ||
EitherUrl::Rust(rust_url) => Bound::new(py, PyUrl::new(rust_url)), | ||
EitherUrl::Bound(py_url) => Ok(py_url), | ||
EitherUrl::Owned(py_url) => Bound::new(py, py_url), | ||
} | ||
} | ||
} | ||
|
||
impl CopyFromPyUrl for EitherUrl<'_> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seeing this again, this looks like it probably should have been AsRef<Url>
and AsMut<Url>
implementations.
Preparation for fixing pydantic/pydantic#7186